package com.jiepos.mpos.biz.http.controller;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.jiepos.mpos.biz.http.service.HttpCommonService;
import com.jiepos.mpos.biz.http.service.HttpCustomService;
import com.jiepos.mpos.common.entity.App_Custom_InfEntity;
import com.jiepos.mpos.common.entity.GpsEntity;

/**
 * 
 * 会员基本信息相关
 * @ProjectName:  [mpos] 
 * @Package com.jiepos.mpos.biz.http.controller 
 * @author 娄伟峰
 * @version 1.0
 * @since 2017年10月12日 下午2:46:55
 * @history（历次修订内容、修订人、修订时间等）
 * @UpdateRemark [说明本次修改内容]
 * @Copyright (c) 2017 江苏杰博实信息技术有限公司
 */
@Controller
@RequestMapping("httpcustom")
public class HttpCustomController {

    @Autowired
    private HttpCustomService httpCustomService;
    @Autowired
    private HttpCommonService httpCommonService;

    /**
     * 用户登录
     *
     * @return
     */
    @RequestMapping("/loginSystem.do")
    public @ResponseBody
    Map loginSystem(HttpServletRequest request, HttpServletResponse response,
                    String login_id, String pass_word, String random_number, String getui_clientid, String sign, GpsEntity gpsEntity) {

        return httpCustomService.queryLoginParam(request,login_id,pass_word,random_number,getui_clientid,sign,gpsEntity);
    }

    @RequestMapping("/getCustomInfo.do")
    public @ResponseBody
    Map getCustomInfo(HttpServletRequest request, HttpServletResponse response,
                      String login_id,String custom_no, String random_number, String sign, GpsEntity gpsEntity){
        return httpCustomService.queryCustomInfo(request,login_id,custom_no,random_number,sign,gpsEntity);
    }

    /**
     * 会员注册信息
     *
     * @param request
     * @param response
     * @param login_id
     * @param pass_word
     * @param rand
     * @param super_login_id
     * @param gpsEntity
     * @return
     */
    @RequestMapping("/userReg.do")
    public @ResponseBody
    Map initSystem(HttpServletRequest request, HttpServletResponse response,
                   String login_id, String pass_word, String rand, String super_login_id, String sign, GpsEntity gpsEntity, App_Custom_InfEntity appCustomInfEntity, String pay_pass_word) throws Exception {
        return httpCustomService.queryCustomParam(request, sign, gpsEntity, login_id, pass_word, rand, super_login_id, appCustomInfEntity, pay_pass_word);
    }

    /**
     * 用户账号重复性验证
     *
     * @param request
     * @param response
     * @param login_id
     * @param gpsEntity
     * @return
     * @throws Exception
     */
    @RequestMapping("/checkLoginId.do")
    public @ResponseBody
    Map checkLoginId(HttpServletRequest request, HttpServletResponse response,
                     String login_id, String sign, GpsEntity gpsEntity) {
        return httpCustomService.checkLoginId(request, login_id, sign, gpsEntity);
    }

    /**
     * 获取我的银行卡信息
     *
     * @param request
     * @param response
     * @param login_id
     * @param random_number
     * @param sign
     * @param custom_no
     * @param gpsEntity
     * @return
     */
    @RequestMapping("/getMyBankCard.do")
    public @ResponseBody
    Map getMyBankCard(HttpServletRequest request, HttpServletResponse response,
                      String login_id, String random_number, String sign, String custom_no, GpsEntity gpsEntity) throws Exception {

            return httpCustomService.getMyBankCard(request,login_id,random_number,sign,custom_no,gpsEntity);
    }
    /**
     *  忘记密码
     * @param request
     * @param response
     * @param login_id
     * @param pass_word
     * @param rand
     * @param gpsEntity
     * @return
     */
    @RequestMapping("/forgetPassWord.do")
    public @ResponseBody
    Map forgetPassWord(HttpServletRequest request, HttpServletResponse response,
                       String login_id, String pass_word,String rand,GpsEntity gpsEntity) throws Exception{
        return httpCommonService.forgetPwd(request,login_id,pass_word,rand,gpsEntity);
    }

    /**
     * 新增信用卡
     * @param request
     * @param response
     * @param login_id
     * @param random_number
     * @param custom_no
     * @param credit_card_no
     * @param credit_phone
     * @param cvv2
     * @param crd_exp
     * @param gpsEntity
     * @return
     */
    @RequestMapping("/saveCreditCard.do ")
    public @ResponseBody
    Map saveCreditCard(HttpServletRequest request, HttpServletResponse response,
                       String login_id, String random_number, String custom_no,String credit_card_no,String
                               credit_phone,String cvv2,String crd_exp,String sign,GpsEntity gpsEntity) throws Exception{
        return httpCustomService.saveCreditCard(request,login_id,random_number,custom_no,credit_card_no,credit_phone,cvv2,crd_exp,sign,gpsEntity);
    }


    /**
     * 实名认证
     */
    @RequestMapping("/saveRealNameAuth.do")
    public @ResponseBody
    Map saveRealNameAuth(HttpServletRequest request, HttpServletResponse response,
                         String login_id, String random_number, String custom_no,
                         String certificate_no,String name,String super_bank_no,String super_bank_nm,
                         String bank_province,String bank_locality,String settle_bank_no,String bank_nm,
                         String settle_acct,String settle_phone,String acct_nm,String credit_card_no,String credit_phone,String cvv2,String crd_exp,
                         String sign,GpsEntity gpsEntity){
        return httpCustomService.saveRealNameAuth(request,response,login_id,random_number,custom_no,
               certificate_no,name,super_bank_no,super_bank_nm,bank_province,bank_locality,settle_bank_no,bank_nm,
               settle_acct,settle_phone,acct_nm,credit_card_no,credit_phone,cvv2,crd_exp,sign,gpsEntity);
    }

    /**
     * 变更登陆账号
     * @param request
     * @param response
     * @param login_id
     * @param random_number
     * @param custom_no
     * @param certificate_no
     * @param new_login_id
     * @param pass_word
     * @param rand
     * @param sign
     * @param gpsEntity
     * @return
     */
    @RequestMapping("/changeLoginId.do")
    public @ResponseBody
    Map changeLoginId(HttpServletRequest request, HttpServletResponse response,
                     String login_id,String random_number,String custom_no,String certificate_no,
                      String new_login_id,String pass_word,String rand,String change_desc, String sign, GpsEntity gpsEntity) throws Exception {
        return httpCustomService.changeLoginId(request, login_id,random_number,custom_no,certificate_no,new_login_id,pass_word,rand,change_desc,sign, gpsEntity);
    }


    /**
     * 上传图片
     */
    @RequestMapping("/saveRealNamePic.do")
    public @ResponseBody
    Map saveRealNamePic(HttpServletRequest request, HttpServletResponse response,
                        String login_id, String random_number, String custom_no,
                        String pic_count,String sign, GpsEntity gpsEntity,
                        @RequestParam(value = "custom_pic1",required = false) MultipartFile custom_pic1,
                        @RequestParam(value = "custom_pic2",required = false) MultipartFile custom_pic2,
                        @RequestParam(value = "custom_pic3",required = false) MultipartFile custom_pic3,
                        @RequestParam(value = "custom_pic4",required = false) MultipartFile custom_pic4,
                        @RequestParam(value = "custom_pic5",required = false) MultipartFile custom_pic5,
                        @RequestParam(value = "custom_pic6",required = false) MultipartFile custom_pic6){

        return httpCustomService.saveRealNamePic(request,response,login_id,random_number,custom_no,pic_count,sign,gpsEntity,
                custom_pic1,custom_pic2,custom_pic3,custom_pic4,custom_pic5,custom_pic6);
    }

    /**
     * 变更结算卡
     */
    @RequestMapping("/modifySettleBank.do")
    public @ResponseBody
    Map modifySettleBank(HttpServletRequest request, HttpServletResponse response,
                         String login_id, String random_number, String custom_no,
                         String bankcard_uuid, String super_bank_no, String super_bank_nm,
                         String bank_province, String bank_locality, String settle_bank_no, String bank_nm,String settle_acct,String settle_phone,String acct_nm,
                         String pic_count,
                         @RequestParam(value = "custom_pic1",required = false) MultipartFile custom_pic1,
                         @RequestParam(value = "custom_pic2",required = false) MultipartFile custom_pic2,
                         @RequestParam(value = "custom_pic3",required = false) MultipartFile custom_pic3,
                         String sign,GpsEntity gpsEntity){

        return httpCustomService.modifySettleBank(request,response,login_id,random_number,custom_no,bankcard_uuid,super_bank_no,
                super_bank_nm,bank_province,bank_locality,settle_bank_no,bank_nm,settle_acct,settle_phone,acct_nm,pic_count,custom_pic1,custom_pic2,custom_pic3,sign,gpsEntity);
    }
    /**
     * 修改密码
     */
    @RequestMapping("/changePassWord.do")
    public @ResponseBody
    Map changePassWord(HttpServletRequest request, HttpServletResponse response,
                      String login_id,String random_number,String custom_no,String pass_word,
                      String rand,String new_pass_word,String sign, GpsEntity gpsEntity) throws Exception {
        return httpCustomService.changePassWord(request, login_id,random_number,custom_no,pass_word,new_pass_word,rand,sign, gpsEntity);
    }
    /**
     * 查询账户余额
     */
    @RequestMapping("/getCustomBalance.do")
    public @ResponseBody
    Map getCustomBalance(HttpServletRequest request, HttpServletResponse response,
                       String login_id,String random_number,String custom_no,String sign, GpsEntity gpsEntity) throws Exception {
        return httpCustomService.getCustomBalance(request, login_id,random_number,custom_no,sign, gpsEntity);
    }
    /**
     * 查询我的推荐用户
     * @param request
     * @param response
     * @param login_id
     * @param random_number
     * @param custom_no
     * @param sign
     * @param gpsEntity
     * @return
     */
    @RequestMapping("/getMyRecommendUser.do")
    @ResponseBody
    public Map getMyRecommendUser(HttpServletRequest request, HttpServletResponse response,
    		String login_id,String random_number,String custom_no,String curr_page,String rows_perpage,String sign,GpsEntity gpsEntity){
    	return httpCustomService.getMyRecommendUser(request,login_id,random_number,custom_no,curr_page,rows_perpage,sign,gpsEntity);
    }
    
    /**
     * 查询我的推荐用户详情
     * @param request
     * @param response
     * @param login_id
     * @param random_number
     * @param custom_no
     * @param sign
     * @param gpsEntity
     * @return
     */
    @RequestMapping("/getMyRecommendUserDetail.do")
    @ResponseBody
    public Map getMyRecommendUserDetail(HttpServletRequest request, HttpServletResponse response,
    		String login_id,String random_number,String custom_no,String sign,GpsEntity gpsEntity){
    	return httpCustomService.getMyRecommendUserDetail(request,login_id,random_number,custom_no,sign,gpsEntity);
    }
    
    /**
     * 意见反馈
     * @param request
     * @param response
     * @param login_id
     * @param random_number
     * @param custom_no
     * @param sign
     * @param title
     * @param content
     * @param gpsEntity
     * @return
     */
    @RequestMapping("/saveFeedback.do")
    @ResponseBody
    public Map saveFeedback(HttpServletRequest request, HttpServletResponse response,
    		String login_id,String random_number,String custom_no,String sign,String title,String content,GpsEntity gpsEntity){
    	return httpCustomService.saveFeedback(request,login_id,random_number,custom_no,sign,title,content,gpsEntity);
    }

    /**
     * 查询会员实名认证信息
     */
    @RequestMapping("/getCustomRealNameInfo.do")
    @ResponseBody
    public Map getCustomRealNameInfo(HttpServletRequest request, HttpServletResponse response,
                            String login_id,String random_number,String custom_no,String sign,GpsEntity gpsEntity){
        return httpCustomService.getCustomRealNameInfo(request,login_id,random_number,custom_no,sign,gpsEntity);
    }
    
    

    /**
     * 查询会员审核信息
     * */
    @RequestMapping("/getCustomAuditDesc.do")
    public @ResponseBody
    Map getCustomAuditDesc(HttpServletRequest request, HttpServletResponse response,
                                                String login_id,String random_number,String custom_no,String sign, GpsEntity gpsEntity){
        return httpCustomService.getCustomAuditDesc(request,login_id,random_number,custom_no,sign,gpsEntity);
    }

    /**
     * 查询会员实名认证图片
     * */
    @RequestMapping("/getCustomRealNamePic.do")
    public @ResponseBody
    Map getCustomRealNamePic(HttpServletRequest request, HttpServletResponse response,
                           String login_id,String random_number,String custom_no,String sign, GpsEntity gpsEntity){
        return httpCustomService.getCustomRealNamePic(request,login_id,random_number,custom_no,sign,gpsEntity);
    }

    /**
     * 查询变更结算卡详细信息
     * */
    @RequestMapping("/getModifySettleBank.do")
    public @ResponseBody
    Map getModifySettleBank(HttpServletRequest request, HttpServletResponse response,
                            String login_id,String random_number,String custom_no,String bankcard_uuid,String sign, GpsEntity gpsEntity){
        return httpCustomService.getModifySettleBank(request,login_id,random_number,custom_no,bankcard_uuid,sign,gpsEntity);
    }

    /**
     * 获取会员基本信息
     * */
    @RequestMapping("/getCustomPersonInfo.do")
    public @ResponseBody Map getCustomPersonInfo(HttpServletRequest request, HttpServletResponse response, String login_id, String custom_no,
                                                 String random_number, String sign, GpsEntity gpsEntity){
        return httpCustomService.getCustomPersonInfo(request,login_id,custom_no,random_number,sign,gpsEntity);
    }

    /**
     * 忘记和修改支付密码
     * @return
     */
    @RequestMapping("/changePayPassWord.do")
    public @ResponseBody Map changePayPassWord(HttpServletRequest request, HttpServletResponse response,String login_id,String random_number,String custom_no,
                                 String pass_word,String old_pay_pass_word,String new_pay_pass_word,String rand,
                                 String certificate_no,String change_type,String sign, GpsEntity gpsEntity){
        return httpCustomService.changePayPassWord(request,login_id,random_number,custom_no,pass_word,
                old_pay_pass_word,new_pay_pass_word,rand,certificate_no,change_type,sign,gpsEntity);
    }

    /**
     * 查询银行卡详细信息
     * @return
     */
    @RequestMapping("/getCustomBankCardDetail.do")
    public @ResponseBody Map getCustomBankCardDetail(HttpServletRequest request,HttpServletResponse response,String login_id,String random_number,String custom_no,
                                       String bankcard_uuid,String sign, GpsEntity gpsEntity){
        return httpCustomService.getCustomBankCardDetail(request,login_id,random_number,custom_no,bankcard_uuid,sign,gpsEntity);
    }

    /**
     * 修改银行卡(信用卡)
     * @return
     */
    @RequestMapping("/updateCustomBankCard.do")
    public @ResponseBody Map updateCustomBankCard(HttpServletRequest request,HttpServletResponse response,String login_id,String random_number,String custom_no,
                                    String cvv2,String crd_exp,String bankcard_uuid,String sign, GpsEntity gpsEntity){
        return httpCustomService.updateCustomBankCard(request,login_id,random_number,custom_no,bankcard_uuid,cvv2,crd_exp,sign,gpsEntity);
    }

    /**
     * 解绑银行卡
     * @return
     */
    @RequestMapping("/unbindCustomBankCard.do")
    public @ResponseBody Map unbindCustomBankCard(HttpServletRequest request,HttpServletResponse response,String login_id,String random_number,String custom_no,
                                                     String bankcard_uuid,String sign, GpsEntity gpsEntity){
        return httpCustomService.unbindCustomBankCard(request,login_id,random_number,custom_no,bankcard_uuid,sign,gpsEntity);
    }
}